﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using IHISCETeim.DAL;
using IHISCETeim.Model;
using IHISCETeim.Library;
using System.Data;

namespace IHISCETeim.BLL
{
    public  class FTradeInvoiceController
    {
        public static int Add(FTradeInvoiceInfo obj)
        {
            return FTradeInvoiceDAL.Add(obj);
        }
        public static bool Delete(int id)
        {
            return FTradeInvoiceDAL.Delete(id);
        }
        public static List<FTradeInvoiceInfo> GetAllByFTradeId(int FTradeId)
        {
            try
            {
                return CBO.FillCollection<FTradeInvoiceInfo>(FTradeInvoiceDAL.GetAllByFTradeId(FTradeId));
            }
            catch
            {
                return new List<FTradeInvoiceInfo>();
            }
        }

        public static FTradeInvoiceInfo GetById(int id)
        {
            return CBO.FillObject<FTradeInvoiceInfo>(FTradeInvoiceDAL.GetById(id));
        }


        public static bool Update(FTradeInvoiceInfo obj)
        {
            return FTradeInvoiceDAL.Update(obj);
        }
        /// <summary>
        /// 转移发票
        /// </summary>
        /// <param name="id"></param>
        /// <param name="newFtradeId"></param>
        /// <returns></returns>
        public static bool ReUse(int id, int newFtradeId)
        {
            return FTradeInvoiceDAL.ReUse(id, newFtradeId);
        }
    }
}
